require(['./config'],() => {
	require(['request','bootstrap','template','header','footer'],(req,bootstrap,template) => {
		class List{
			constructor() {
			    this.getProdId()
				// this.creatList()
				this.getListData()
			}
			getProdId(){
				// 通过地址栏 拿到prodid 然后发送请求
				// console.log(123)
				// let str = window.location.search  //?prodId=5
				// str = str.split('=')[1]
					
				const str = window.location.search.split('=')[1]
				// console.log(str)
				this.getListData(str)
			}
			getListData(prodId){
				req.getListProdData(prodId)
					.then(res => {
						if(res.code === 200){
							const { items } = res.data 
							this.createList(items)
						}
						// console.log(res)
					})
			}
			
			// 请求列表商品数据
			createList(prodList){
				console.log(prodList)
				const { list } = prodList
				$('#cakeList').html(template('prodListTemplate',{list}))
			}
					
			}		
				return new List()
		})
		
	})